package io.gitee.pkmer.mybatis.support;

import lombok.Getter;

import java.lang.reflect.ParameterizedType;
import java.lang.reflect.Type;

/**
 * @author <a href="mailto:1193094618@qq.com">pkmer</a>
 * <br>
 * <a href = "https://gitee.com/developeros/videos-online">Code Repository</a>
 * At 2024/9/4
 * 获取真实的泛型类
 */
@Getter
public class GenericTypeProcess<T> {
    protected Class<T> type;

    @SuppressWarnings("unchecked")
    protected GenericTypeProcess(){
        Type superClass = getClass().getGenericSuperclass();
        type = (Class<T>) ((ParameterizedType) superClass).getActualTypeArguments()[0];
    }

}
